﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script type="text/javascript" src="Scripts/angular.js"></script>
</head>
<body>
    <div ng-app="myApp" ng-controller="myCtrl" ng-init="quantity=1;price=5">
        名字：<input ng-model="name" />
        <p></p>
        <p>双向绑定</p>
       输入: <input ng-model="name2">

        <h1>你输入了: {{name2}}</h1>
        <p></p>
        <h2>价格计算器</h2>

        数量： <input type="number" ng-model="quantity">
        价格： <input type="number" ng-model="price">

        <p><b>总价：</b> {{ quantity * price }}</p>

    </div>
    <script type="text/javascript">
        var app = angular.module("myApp", []);
        app.controller("myCtrl", function ($scope) {

            $scope.name = "John Doe";
        });
    </script>

</body>
</html>